<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">

<head>
  <title><%= @page_title || 'Spendy!' %></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <%= stylesheet_link_tag 'style' %>
  <%= javascript_include_tag :defaults %>
</head>

<body>

  <% flash.each do |key,value| -%>
  <div id="flash-<%= key %>" class="flash overlay">
    <%= link_to_function image_tag("famfamfam/delete.png"), "Effect.BlindUp('flash-#{key}', {duration: 0.8});" %>
    <p><span><%= value %></span></p>
  </div>
  <%= javascript_tag "new Effect.Highlight('flash-#{key}', {duration: 2});" %>
  <% end -%>

  <% if !logged_in? -%>
  <div id="login" class="overlay" style="display: none;">
    <%= link_to_function image_tag("famfamfam/delete.png"), "Effect.BlindUp('login', {duration: 0.8});" %>
    <%= render :partial => 'sessions/new' %>
  </div>
  <% end -%>

  <div id="wrapper">

    <div id="header">
      <div id="header-top">
        <span class="hidden">Navigation:</span>
        <% if logged_in? %> 
          <%= link_to 'logout', {:controller => "sessions", :action => "destroy"}, :method => :delete %>
		  <%= link_to 'home', {:controller => "welcome", :action => "home"} %>
		  <%= link_to 'categories', {:controller => "categories"} %>
          <%= link_to 'expenses', {:controller => "expenses"} %>
        <% else %>
          <%= link_to_function 'login', "Effect.toggle('login', 'blind', {duration: 0.8})" %>
		  <%= link_to "sign up", :controller => "users", :action => "new" %>
        <% end %> 
      </div>

      <div id="header-bottom">
        <h1><%= link_to "Spendy!", :controller => "welcome" %></h1>
      </div>
    </div>

    <div id="content">
      <%= yield :layout %>
    </div>

  </div>

</body>
</html>
